ReactJS Ultra For Beginners

🌟 How to Use React Components


What Is a Component?

  • Reusable UI building block
  • Function or class
  • Accepts props and returns JSX

How to Use a Component

  1. Define it
  2. Import it
  3. Render it with props
// Greeting.jsx export function Greeting({ name }) { return <h1>Hello, {name}!</h1>; } // App.jsx import React from "react"; import { Greeting } from "./Greeting"; export default function App() { return ( <div> {/* Render the Greeting component */} <Greeting name="Pedro" /> </div> ); }